<h1><span></span><?= $result->name ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><a href="<?= base_url('user/profile') ?>"><?= lang('label_profile') ?></a></li>
    <li><a href="<?= base_url('cases') ?>"><?= lang('label_resloution_center'); ?></a></li>
    <li><?= $result->name ?></li>
</ul>


<div class="page">

    <?php $this->load->view('template/default/cases/top') ?>

    <div style="overflow:hidden;">
        <?php $this->load->view('template/default/cases/side') ?>
        <div class="profile_page">
            <h2 class="profile_page_title"><?= lang('label_resloution_center'); ?> &raquo; <strong><?= $result->name ?></strong></h2>

            <div class="profile_messages">
                <strong><span><a href="<?= base_url("products/view/$result->product_id") ?>" target="_blank"><?= $result->name ?></a></span></strong> <span style="margin-right: 15px;display: inline-block;color: #B0B0B0;"><?= timespan($result->create_date) ?></span>
                <br />
                <strong><?= lang('label_username') ?>: </strong><?= get_username_with_id($result->user_id) ?>
                <br />
                <strong><?= lang('label_store') ?>: </strong><?= get_store_name_by_id($result->store_id) ?>
                <p style="font-size: 16px">
                    <?php echo $result->reson; ?>
                    <?php if ($result->close == 'NO') { ?>
                    <form class="forms inside_1" id="private_message_form" action="<?php echo current_url() ?>" method="post">
                        <div class="profile_messages_reply" >
                            <textarea rows="" cols="" name="comment" id="private_message_reply"></textarea>
                            <a class="replya" href="javascript:void(0)" id="privaye_message_add_reply"><?= lang('label_replay') ?></a>
                        </div>

                    </form>
                <?php } ?>
                <div class="newreplaies"></div>
                <?php if ($reply) { ?>
                    <?php foreach ($reply as $val) { ?>
                        <div class="profile_messages private_message_reply">
                            <strong><span><?= $val->username ?></span></strong> <span style="margin-right: 15px;display: inline-block;color: #B0B0B0;"><?= timespan($val->create_date) ?></span>
                            <p style="font-size: 16px"><?= $val->comment ?></p>
                        </div>
                    <?php } ?>
                <?php } ?>
            </div>
        </div></div>
</div>



<script type="text/javascript">
    $(document).ready(function() {

        $('#privaye_message_add_reply').bind('click', function() {
            if ($('#private_message_reply').val() == '') {
                $('#private_message_reply').css({'border': 'red solid 1px'});
            } else {
                $.ajax({
                    url: '<?php echo base_url() ?>cases/add_replay/<?php echo $result->id; ?>',
                    type: 'POST',
                    data: $('#private_message_form').serialize(),
                    error: function() {
                        alert('<?= lang('message_save_error') ?>');
                    },
                    success: function(data) {
                        $('.newreplaies').append(data).fadeIn("slow");
                        //$('#private_message_form').hide();
                    }
                });
            }

            return false;
        });
    });

</script>

</div>